package cn.dengl.sky.springboot.sys.service;

import cn.dengl.sky.springboot.sys.IService.IAccount;
import cn.dengl.sky.springboot.sys.dao.AccountDao;
import cn.dengl.sky.springboot.sys.entity.Account;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service("accountService")
@Transactional(rollbackFor={IllegalArgumentException.class})
public class AccountService implements IAccount {

    @Resource
    private AccountDao accountDao;
    @Override
    public void insert(Account account) {
        accountDao.addAccount(account);
    }

    @Override
    public void delete(int id) {
        accountDao.deleteAccount(id);
    }

    @Override
    public void update(Account account) {
        accountDao.updateAccount(account);
    }
    @Override
    public List<Account> find(String loginName) {
        return accountDao.selectUserByName(loginName);
    }

}
